<?php 
	require dirname ( __FILE__ ) . '/lib/init.php';
	$listobj = get_user_list();
	$crumbcode = Crumb::issueCrumb($_SESSION ["USERID"],"USERDEL");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>安联内容管理系统</title>
	<script type="text/javascript" src="js/jquery.js"></script>
	<link rel="stylesheet" type="text/css" href="css/base.css" />
	<script type="text/javascript">
		$(document).ready(function(){
			$("#delete_product").click(function(){
				var chkarray = new Array();
				$(":checked").each(function(i,obj){
					if(obj.name == "oid[]"){
						chkarray.push(obj.value);
					}
				});
				if(chkarray.length <= 0){
					parent.show_alert("请选择要删除的选项!");
					return false;
				}
				parent.show_confirm("您确定要删除吗?",function(){
					$.post("action/userAction.php",
							{'oid[]':chkarray,'useraction':'USERDEL','crumb_code':'<?php echo $crumbcode;?>'},
							function(data){
								parent.show_alert(data);
								self.location.reload();
							});
					});
					
			});
			
		});
	</script>
</head>
<body>
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td height="50" align="left" valign="middle" style="padding-left: 50px;">
	    <table width="200" border="0" cellspacing="0" cellpadding="0" align="left">
	      <tr>
	        <td><button onclick="parent.show_dialog('USERADD','添加用户','user_add.php',600,300)" class="formButton">添加用户</button></td>
	        <td><button id="delete_product" class="formButton">删除用户</button></td>
	      </tr>
	    </table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top" style="padding-left: 50px;">
	    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
	      <tr>
	        <td>
		        <table width="99%" border="1" align="center" cellpadding="0" cellspacing="1">
		          <tr>
		            <td width="5%" height="30" align="center">选择</td>
		            <td width="35%" align="center">姓名</td>
		            <td width="30%" align="center">权限</td>
		            <td width="30%" align="center">操作</td>
		          </tr>
		          <?php foreach ($listobj as $lobj):?>
		          <tr>
		            <td height="20" align="center"><input type="checkbox" name="oid[]" value="<?php echo $lobj["oid"]?>" /></td>
		            <td align="center"><?php echo $lobj["user_name"];?></td>
		            <td align="center"><?php echo $lobj["user_role"];?></td>
		            <td align="center">
		            	<button onclick="parent.show_dialog('USEREDIT','编辑用户','user_edit.php?oid=<?php echo $lobj["oid"]?>',600,300)" class="formButton">编辑用户</button>
		            </td>
		          </tr>
		          <?php endforeach;?>
		        </table>
	        </td>
	      </tr>
	    </table>
    </td>
  </tr>
</table>
</body>
</html>